import time

from pywinauto.application import Application

# Application(backend="uia").start("C:\\Program Files\\Sublime Text\\sublime_text.exe")
# app = Application(backend="uia").connect(process=36496)
# # print(app.process)
# win = app.window(title_re=".*Sublime Text.*")
# win.wait("exists")
# # win.print_control_identifiers()
# # ['应用程序', '应用程序Menu', 'Menu2']
# # menu = win["应用程序Menu"]
# # menu = win["MenuItem2"]
# # win.window(title="位置", auto_id="ScrollbarThumb", control_type="Thumb")
# # menu = win["系统Menu"]
# # win.child_window(title="位置", auto_id="ScrollbarThumb", control_type="Thumb")
# # win.child_window(auto_id="ScrollbarThumb", control_type="Thumb")
# # win.child_window(control_type="Thumb")
# # win.child_window(auto_id="ScrollbarThumb")
# win.child_window(class_name="ScrollBar",control_type="Pane",found_index=0).click_input()

app = Application(backend="uia").connect(process=33808)
win = app.window(title="计算器")
wait = win.wait("visible")
# win.print_control_identifiers()
num = win.child_window(title="二", auto_id="num2Button", control_type="Button")
num.click_input()
sqrt = win.child_window(title="平方", auto_id="xpower2Button", control_type="Button")
sqrt.double_click_input()
